package work823;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class work7Server {
  public static void main(String[] args) {
//创建DatagramSocket对象，接受数据
    ServerSocket ss = null;
    try {
      ss = new ServerSocket(8888);
      System.out.println("服务器已启动，等待客户端连接请求");
      while(true){
        Socket socket = ss.accept();
        System.out.println(socket.getInetAddress().getHostAddress() + ":" + socket.getPort() + "已连接");
        new work7Thread(socket).start();
      }
    } catch (SocketException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
